<?PHP
include "mail.php";
include "common_vars.php";
class customer
{
	function customer($customer_id)
	{
		if($customer_id)
		{
			$st="SELECT * FROM customer WHERE customer_id='$customer_id'";
			$rc = mysql_query($st) or die(mysql_error());
			$a_rw=mysql_fetch_array($rc);
			$this->customer_id=$a_rw['customer_id'];
			$this->name=$a_rw['name'];
			$this->surname=$a_rw['surname'];
			$this->father_name=$a_rw['father_name'];			
			$this->address=$a_rw['address'];
			$this->b_date=$a_rw['b_date'];
			$this->age=$a_rw['age'];
			$this->gender=$a_rw['gender'];
			$this->community=$a_rw['community'];
			$this->city=$a_rw['city'];
			$this->other_city=$a_rw['other_city'];
			$this->occupation=$a_rw['occupation'];
			$this->email=$a_rw['email'];
			$this->password=$a_rw['password'];
			$this->tel=$a_rw['tel'];
			$this->mob=$a_rw['mob'];
			$this->marital_status=$a_rw['marital_status'];
			$this->nochildren=$a_rw['nochildren'];
			$this->child_live=$a_rw['child_live'];
			$this->mothertongue=$a_rw['mothertongue'];
			$this->nativeplace=$a_rw['nativeplace'];
			$this->othernative=$a_rw['othernative'];
			$this->country=$a_rw['country'];
			$this->state=$a_rw['state'];
			$this->home_status=$a_rw['home_status'];
			$this->blood_group=$a_rw['blood_group'];			
			$this->feetInch=$a_rw['feetInch'];
			$this->feetCm=$a_rw['feetCm'];
			$this->weightKg=$a_rw['weightKg'];
			$this->weightlbs=$a_rw['weightlbs'];
			$this->bodytype=$a_rw['bodytype'];
			$this->complexion=$a_rw['complexion'];
			$this->degree=$a_rw['degree'];
			$this->stream=$a_rw['stream'];
			$this->other_education=$a_rw['other_education'];
			$this->income=$a_rw['income'];
			$this->curency=$a_rw['curency'];
			$this->incometype=$a_rw['incometype'];
			$this->aboutfamily=$a_rw['aboutfamily'];
			$this->expectation=$a_rw['expectation'];
			$this->reference=$a_rw['reference'];
			$this->father_info=$a_rw['father_info'];
			$this->brother_info=$a_rw['brother_info'];
			$this->sister_info=$a_rw['sister_info'];
			$this->family_member=$a_rw['family_member'];
			$this->earning_member=$a_rw['earning_member'];
			$this->status=$a_rw['status'];
			$this->online=$a_rw['online'];
			$this->paid=$a_rw['paid'];


		}
	}

	function get_customer_count()
	{
	   $row=mysql_query("select count(*) from customer") or die(mysql_error());
	   $res=mysql_fetch_row($row);
	   return $res[0];
	}

	function list_customer($sortBy,$dir,$b,$pagecount)
	{
	    $qR=mysql_query("select cu.customer_id, cu.first_name, cu.last_name, cu.status, cu.user_type, cu.email, cu.address, cu.phone_mobile, c.city from customers as cu, cb_city as c where cu.city = c.city_id AND cu.status!='D' ORDER BY cu.date_created DESC LIMIT $b, $pagecount") or die(mysql_error());
		while($row=mysql_fetch_assoc($qR)) {
			$data[] = $row;
		}
		return $data;
	}

	function change_status($flg_status)
	{
			$query_data	= "Update customers set status='$flg_status' where customer_id='$this->customer_id'";
			$result_update	= mysql_query ( $query_data ) or die(mysql_error());
			$mesg = "Customer status has been changed.";
			return $mesg;
	}

	function validateCustomer($username,$password,$flg)
	{
		$str="select count(*) from customer where email='$username'";

		$rc = mysql_query($str) or die ("Sorry! could not execute query $str ".mysql_error());
		$count=mysql_fetch_row($rc);

		if($count[0]<1)
		{
			$mesg="<center>Invalid Username try again!</center>";
		}
		else
		{
			$stra="select email, name, customer_id, password as pwd, surname, paid from customer where email='$username'";
			$rca = mysql_query($stra) or die ("Sorry! could not execute query $str ".mysql_error());

					$a_row=mysql_fetch_array($rca);

					$username=$a_row['email'];
					$customer_id=$a_row['customer_id'];
					$checkPassword=$a_row['pwd'];
					$newpassword=$password;


				if($newpassword == $checkPassword)
				{		
						/*setcookie("ep_customer_id", $customer_id, time()+3600, "/","", 0);
						setcookie("ep_customername", "$username", time()+3600, "/","", 0);
						setcookie("ep_customer_name", $a_row['name'], time()+3600, "/","", 0);
						setcookie("ep_email", $a_row['email'], time()+3600, "/","", 0);
						setcookie("paid_customer_status", $a_row['paid'], time()+3600, "/","", 0); */

						session_register("ep_customer_id");
						session_register("ep_customername");
						session_register("ep_customer_name");
						session_register("ep_email");
						session_register("paid_customer_status");

						$_SESSION['ep_customer_id'] = $customer_id;
						$_SESSION['ep_customername'] = $username;
						$_SESSION['ep_customer_name'] = $a_row['name']." ".$a_row['surname'];
						$_SESSION['ep_email'] = $a_row['email'];
						$_SESSION['paid_customer_status'] = $a_row['paid'];

					//customer online code here
					$online ="update customer set online = now() where email='$username'";
					$rsb = mysql_query($online);
					//online customer code ends here

						if($_SESSION['gbl_from_art']!=""){
							$tmp_var_5=$_SESSION['gbl_from_art'];						
							unset($_SESSION['gbl_from_art']);
							header("Location:articles/article_comment.php?art=".$tmp_var_5);
							exit;
							//code end purab 14 jun 2007
						}else if($_SESSION['gbl_from_community1']=="Y"){
							unset($_SESSION['gbl_from_community1']);
							header("Location:articles/mod_articles.php");
							exit;
						} else if($flg=="NEW"){
							header("Location:myaccount.php?flg=1");
						} else {
							header("Location:myaccount.php");
						}
						
						
						
				} else {
						$mesg="<center>Password is not matching! Try again!</center>";
				}
		}
		return $mesg;
	}







	function sendPassword($username)
	{
		global $gbl_from_email, $gblAdminEmail;
		$str="select count(*) from customer where email='$username' AND status='Y'";

                

		$rc = mysql_query($str) or die ("Sorry! could not execute query $str ".mysql_error());
		$count=mysql_fetch_row($rc);

               

		if($count[0] < 1 )
		{
			$mesg="Sorry !! You have entered wrong username/hint question/answer. Please try again.";
		}
		else
		{
			$str="select password, name, customer_id, email from customer where email='$username' AND status='Y'";
			$rc = mysql_query($str) or die ("Sorry! could not execute query $str ".mysql_error());

			$password=mysql_fetch_row($rc);
			//$new_password = createRandomPassword();
			//$sql = "UPDATE customers SET password = md5('".$new_password."') WHERE username = '".$username."' AND status != 'D'";
			//mysql_query($sql) OR die(mysql_error());

			$subject = "eparinay.com: Your Password.";
			$body = "Please find your password below:<BR>";
			$body .= $password[0];
			$body .= "<BR>";
			$header = "From: support@eparinay.com\r\n";
			$header .= "MIME-Version: 1.0\r\n";
			$header .= "Content-type: text/html; charset=iso-8859-1\r\n";

                        $fp= fopen('/tmp/f1.txt','w');
                        fwrite($fp,$password[0]);
                        fclose($fp);

			if($password[0]){
                        

				//mail_new(<to>,<subject>,<body_mail>,<header>,<from>,<CC>);
				mail_new($row['email'],$subject,$body,$header,$gblAdminEmail,$gblAdminEmail);

				$mesg = "Thank You !! for submitting your request. Your new password has been e-mailed to you.";
			} else {
				$mesg ="Error Occured! Please try again.";
			}

		}
		return $mesg;
	}

function add_customer()
	{	

		$str="SELECT count( * ) FROM customer WHERE email ='$this->email'";

		$rc = mysql_query($str) or die ("Sorry! could not execute query $str ".mysql_error());
		$count=mysql_fetch_row($rc);

		if($count[0] > 0)
		{
			$mesg="Sorry !! This username is already exists in the system.";
		}
		else
		{
					$query_data	= "INSERT INTO customer ( `name` , `surname` , `father_name` , `address` , `b_date` , `age` , `gender` , `community` , `city` , `other_city` , `occupation` , `email` , `password` , `tel` , `mob` , `marital_status` , `nochildren` , `child_live` , `mothertongue` , `nativeplace` , `othernative` , `country` , `state` , `home_status` , `feetInch` , `feetCm` , `weightKg` , `weightlbs` , `bodytype` , `complexion` , `degree` , `stream` , `other_education` , `income` , `curency` , `incometype` , `aboutfamily` , `expectation` , `reference` , `father_info` , `brother_info` , `sister_info` , `family_member` , `earning_member` , `status` , `online`,`paid` )
VALUES

('".addslashes($this->name)."' , '".addslashes($this->surname)."' , '".addslashes($this->father_name)."' , '".addslashes($this->address)."' , '".addslashes($this->b_date)."' , '".addslashes($this->age)."', '".addslashes($this->gender)."' , '".addslashes($this->community)."' , '".addslashes($this->city)."' , '".addslashes($this->other_city)."' , '".addslashes($this->occupation)."' , '".addslashes($this->email)."' , '".addslashes($this->password)."' , '".addslashes($this->tel)."' , '".addslashes($this->mob)."' , '".addslashes($this->marital_status)."' , '".addslashes($this->nochildren)."' , '".addslashes($this->child_live)."' , '".addslashes($this->mothertongue)."' , '".addslashes($this->nativeplace)."' , '".addslashes($this->othernative)."' , '".addslashes($this->country)."' , '".addslashes($this->state)."', '".addslashes($this->home_status)."', '".addslashes($this->feetInch)."', '".addslashes($this->feetCm)."', '".$this->weightKg."','".$this->weightlbs."','".$this->bodytype."','".$this->complexion."','".$this->degree."','".$this->stream."','".$this->other_education."','".$this->income."','".$this->curency."','".$this->incometype."','".$this->aboutfamily."','".$this->expectation."','".$this->reference."','".$this->father_info."','".$this->brother_info."','".$this->sister_info."','".$this->family_member."','".$this->earning_member."', 'N' , now(), 'N')";

			$result_update	= mysql_query ( $query_data ) or die(mysql_error());
			// send email query starts here
			$subject = "eParinay.com: New registration.";
						$body = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><style>.orange-table{    border-style: solid;	border-width: 1px;	border-color: #3399FF;	border-collapse: collapse}.form-txt{font-size: 13px;COLOR: #1D1DA2;font-weight: bold;font-family: arial, verdana}.normal-txt{    font-size: 12px;    COLOR: #414141;    font-family: arial, verdana}</style></head>
								<body leftmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">
								<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" align=\"center\" class=\"orange-table\">
								<tr><td class=\"form-txt\">Dear $this->username,</td></tr>
								<tr>
								  <td class=\"normal-txt\">Congratulations and greetings from eParinay.com for your successful registration. We look forward to serve you.<BR>
								If you wish to search for your Groom or Bride click Here : <a target=\"_blank\" href=\"http://www.eparinay.com\">www.eParinay.com</a><br>
								If you wish to log in and Update your profile and send message to other click the link: <a target=\"_blank\" href=\"http://www.eparinay.com/login.php\">www.eParinay.com/login.php</a><br>
								<br>
								Please contact us for any of your queries by emailing us at : <a href=\"mailto:support@eparinay.com\">support@eParinay.com</a>. We would be privileged to serve you.<BR>
								<BR>
								Your username/password are as below: <BR><BR>
								Username: $this->email<BR>Password: $this->password
								<BR><BR>
								</td>
								</tr><tr><td class=\"form-txt\">Thanks and regards, <br>
								  eParinay.com team.</td>
								</tr></table></body></html>";

			$header = "From: $gbl_from_email\r\n";
			$header .= "MIME-Version: 1.0\r\n";
			$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
			if($this->email){
				//mail_new(<to>,<subject>,<body_mail>,<header>,<from>,<CC>);
				mail_new($this->email,$subject,$body,$header,$gblAdminEmail,$gbl_from_email);
			}
			
			
			}
			return $mesg;

			//$mesg="Congradulations !! You have been registered successfully.";

	}

	function mod_customer()
	{
			$query_data	= "UPDATE customer
							SET
							name='".addslashes($this->name)."',
							surname='".addslashes($this->surname)."',
							father_name='".addslashes($this->father_name)."',
							father_info='".addslashes($this->father_info)."',
							address='".addslashes($this->address)."',
							b_date='".addslashes($this->b_date)."',
							age='".addslashes($this->age)."',
							gender='".addslashes($this->gender)."',
							community='".addslashes($this->community)."',
							city='".addslashes($this->city)."',
							other_city='".addslashes($this->other_city)."',
							occupation='".addslashes($this->occupation)."',
							tel='".addslashes($this->tel)."',
							mob='".addslashes($this->mob)."',
							marital_status='".addslashes($this->marital_status)."',
							nochildren='".addslashes($this->nochildren)."',
							child_live='".addslashes($this->child_live)."',
							mothertongue='".addslashes($this->mothertongue)."',
							nativeplace='".addslashes($this->nativeplace)."',
							othernative='".addslashes($this->othernative)."',
							country='".addslashes($this->country)."',
							state='".addslashes($this->state)."',
							home_status='".addslashes($this->home_status)."',
							blood_group='".addslashes($this->blood_group)."',							
							feetInch='".addslashes($this->feetInch)."',
							feetCm='".addslashes($this->feetCm)."',
							weightKg='".addslashes($this->weightKg)."',
							weightlbs='".addslashes($this->weightlbs)."',
							bodytype='".addslashes($this->bodytype)."',
							complexion='".addslashes($this->complexion)."',
							degree='".addslashes($this->degree)."',
							stream='".addslashes($this->stream)."',
							other_education='".addslashes($this->other_education)."',
							income='".addslashes($this->income)."',
							curency='".addslashes($this->curency)."',
							incometype='".addslashes($this->incometype)."',
							aboutfamily='".addslashes($this->aboutfamily)."',
							expectation='".addslashes($this->expectation)."',
							brother_info='".addslashes($this->brother_info)."',
							sister_info='".addslashes($this->sister_info)."',
							family_member='".addslashes($this->family_member)."',
							earning_member='".addslashes($this->earning_member)."',
							reference='".addslashes($this->reference)."'

							WHERE customer_id = $this->customer_id";
			$result_update	= mysql_query ( $query_data ) or die(mysql_error());
			$mesg = "Your profile has been modified Sucessfully.";
			return $mesg;
	}

	function mod_customer_pwd($old_password, $new_password)
	{
		$str="select password as pwd from customers where customer_id=".$_SESSION['ep_customer_id'];
		$rc = mysql_query($str) or die ("Sorry! could not execute query $str ".mysql_error());

					$a_row=mysql_fetch_array($rc);

					$checkPassword=$a_row['pwd'];
					$old_password=md5($old_password);

				if($old_password == $checkPassword)
				{
					$query_data	= "UPDATE customers
									SET last_modified = now(),
									password = '".md5($new_password)."' WHERE customer_id=".$_SESSION['ep_customer_id'];
					$result_update	= mysql_query ( $query_data ) or die(mysql_error());
					$mesg = "Your password has been changed. Please use this new password to login the next time.";
				} else {
					$mesg = "Error - Authentication Failed. Old password found to be incorrect.";
				}
		return $mesg;
	}


	function delete_customer()
	{
		$query_data = "Update customers set status='D' where customer_id=$this->customer_id";
		$result_update	= mysql_query ( $query_data ) or die(mysql_error());
		$mesg="Customer deleted successfully";

		return $mesg;
	}

function q_add_customer()
	{	
		$str="SELECT count( * ) FROM customer WHERE tel ='$this->tel'";

		$rc = mysql_query($str) or die ("Sorry! could not execute query $str ".mysql_error());
		$count=mysql_fetch_row($rc);

		if($count[0] > 0)
		{
			$mesg="Sorry !! This Telephone No. is already exists in the system.";
		}
		else
		{
		
		$str="SELECT count( * ) FROM customer WHERE email ='$this->email'";

		$rc = mysql_query($str) or die ("Sorry! could not execute query $str ".mysql_error());
		$count=mysql_fetch_row($rc);

		if($count[0] > 0)
		{
			$mesg="Sorry !! This username is already exists in the system.";
		}
		else
		{
					$query_data	= "INSERT INTO customer ( `name` , `surname` ,`address` , `b_date` , `age` , `gender` , `community` , `city` , `other_city` ,  `email` , `password` , `tel` , `mob` , `marital_status` ,   `expectation` , `status` , `online`,`paid` )
VALUES

('".addslashes($this->name)."' ,'".addslashes($this->surname)."' , '".addslashes($this->address)."' , '".addslashes($this->b_date)."' , '".addslashes($this->age)."', '".addslashes($this->gender)."' , '".addslashes($this->community)."' , '".addslashes($this->city)."' , '".addslashes($this->other_city)."' , '".addslashes($this->email)."' , '".addslashes($this->password)."' , '".addslashes($this->tel)."' , '".addslashes($this->mob)."' , '".addslashes($this->marital_status)."' ,'".$this->expectation."','N' , now(), 'N')";

			$result_update	= mysql_query ( $query_data ) or die(mysql_error());
			// send email query starts here
			$subject = "eParinay.com: New registration.";
						$body = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<style>
 body{
	margin:0px;
	padding:0px;
	background-repeat:repeat;
	font-weight:normal;
	background-color:#FFFFFF;
	font: 11px Tahoma, Arial, Helvetica, sans-serif;
	color:#133959;
}
a{
	font:11px Tahoma, Arial, Helvetica, sans-serif;
	color:#0066CC;
	font-weight:normal;
	text-decoration:underline;
}
a:link{
	font:11px Tahoma, Arial, Helvetica, sans-serif;
	color:#0066CC;
	font-weight:normal;
	text-decoration:underline;
}
a:hover{
	font:11px Tahoma, Arial, Helvetica, sans-serif;
	color:#f25121;
	font-weight:normal;
	text-decoration:none;
	background-color:#FFFFCC;
}
p{
	font:11px Tahoma, Arial, Helvetica, sans-serif;
	color:#133959;
	text-align:justify;
	line-height:13px;
	word-spacing:normal;
	font-weight:normal;
	margin: 2px;
	padding-bottom: 5px;
}
h3{
	font:14px Tahoma, Arial, Helvetica, sans-serif;
	color:#FFFFFF;
	font-weight:normal;
	text-align:center;
}
table{
	border:1px solid #cccccc;
	padding:1px;
	background-color:#EDF9FE;
}
tr{
	background-color:#FFFFFF;
	padding:5px;
}
td{
	font:11px Tahoma, Arial, Helvetica, sans-serif;
	color:#133959;
	text-align:justify;
	line-height:13px;
	font-weight:normal;
}
td.username{
	font:12px Tahoma, Arial, Helvetica, sans-serif;
	color:#3399ff;
	text-align:left;
	line-height:13px;
	font-weight:bold;
}
td.thanks{
	font:11px Tahoma, Arial, Helvetica, sans-serif;
	color:#3399ff;
	text-align:left;
	line-height:13px;
	font-weight:normal;
}
span.green{
	font:11px Tahoma, Arial, Helvetica, sans-serif;
	color:#009900;
	text-align:left;
	line-height:13px;
	font-weight:normal;
}

</style>
</head>
								<body>
                                
								<table cellpadding=\"2\" cellspacing=\"3\" border=\"0\" align=\"center\">
                                <tr style=\"background-color:#FFFFFF;\"><td><a href=\"www.eparinay.com\"><img src=\"http://www.eparinay.com/images/images/logo.jpg\" alt=\"www.eparinay.com\" title=\"www.eparinay.com\" width=\"180\" height=\"72\" border=\"0\"></a></td>
                                </tr>
								<tr><td class=\"username\">Dear $this->name,</td></tr>
								<tr>
								  <td>Congratulations and greetings from eParinay.com for your successful registration. We look forward to serve you.<BR>
								If you wish to search for your Groom or Bride click Here : <a target=\"_blank\" href=\"http://www.eparinay.com\">www.eParinay.com</a><br>
								If you wish to log in and Update your profile and send message to other click the link: <a target=\"_blank\" href=\"http://www.eparinay.com/login.php\">www.eParinay.com/login.php</a><br>
								<br>
								Please contact us for any of your queries by emailing us at : <a href=\"mailto:support@eparinay.com\">support@eParinay.com</a>. We would be privileged to serve you.<BR>
								<BR>
								Your username/password are as below: <BR><BR>
								Login Email: <span class=\"green\">$this->email</span><BR>
								Password: <span class=\"green\">$this->password</span>
								<BR><BR>
								</td>
								</tr><tr><td class=\"thanks\">Thanks and regards, <br>
								  eParinay.com team.</td>
								</tr></table></body></html>";

			$header = "From: $gbl_from_email\r\n";
			$header .= "MIME-Version: 1.0\r\n";
			$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
			if($this->email){
				//mail_new(<to>,<subject>,<body_mail>,<header>,<from>,<CC>);
				mail_new($this->email,$subject,$body,$header,"support@eparinay.com","purabdk@yahoo.co.in");
			}
			
			
			}}
			return $mesg;

			//$mesg="Congradulations !! You have been registered successfully.";

	}
	
	
/*function send_message($send_to, send_from,$content){
//sending email to 
$sql="select customer.name, customer.email from customer where customer.customer_id = $send_to";
$rs = mysql_query($sql) or die(mysql_error());
$cnt = mysql_num_rows($rs);
$subject = "eParinay.com: You Got Message from";
						$body = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><style>.orange-table{    border-style: solid;	border-width: 1px;	border-color: #3399FF;	border-collapse: collapse}.form-txt{font-size: 13px;COLOR: #1D1DA2;font-weight: bold;font-family: arial, verdana}.normal-txt{    font-size: 12px;    COLOR: #414141;    font-family: arial, verdana}</style></head>
								<body leftmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">
								<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" align=\"center\" class=\"orange-table\">
								<tr><td class=\"form-txt\">Dear customer,</td></tr>
								<tr>
								  <td class=\"normal-txt\">Congratulations and greetings from eParinay.com. you got message from . <BR>
								If you wish to search for your Groom or Bride click Here : <a target=\"_blank\" href=\"http://www.eparinay.com\">www.eParinay.com</a><br>
								If you wish to log in and Update your profile and send message to other click the link: <a target=\"_blank\" href=\"http://www.eparinay.com/login.php\">www.eParinay.com/login.php</a><br>
								<br>
								Please contact us for any of your queries by emailing us at : <a href=\"mailto:support@eparinay.com\">support@eParinay.com</a>. We would be privileged to serve you.<BR>
								<BR>
								Your username/password are as below: <BR><BR>
								Username: $this->email<BR>Password: $this->password
								<BR><BR>
								</td>
								</tr><tr><td class=\"form-txt\">Thanks and regards, <br>
								  eParinay.com team.</td>
								</tr></table></body></html>";

			$header = "From: $gbl_from_email\r\n";
			$header .= "MIME-Version: 1.0\r\n";
			$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
			if($this->email){
				//mail_new(<to>,<subject>,<body_mail>,<header>,<from>,<CC>);
				mail_new($this->email,$subject,$body,$header,"support@eparinay.com","purabdk@yahoo.co.in");

}	*/


function send_message($sendto,$scrap){
      $sql ="INSERT INTO `scrap` (`scrap_id` ,`from` ,`to` ,`scrap` ,`created_at` ,`approve`)
VALUES ('',$_SESSION[ep_customer_id],'".$sendto."','".$scrap."',now(),'');";
    $result_update	= mysql_query( $sql ) or die(mysql_error());
    $mesg = "Message Sened Sucessfully.";
// sending email to both customer..
    $cid = $_POST['send_message_to'];
    $sql2 = "select email from customer where customer_id = $cid";
    $rc2 = mysql_query($sql2) or die(mysql_error());

    if($row2=mysql_fetch_array($rc2)) {
        $email = $row2['email'];
        $sender = $_SESSION['ep_email'];
        $gblAdminEmail = "support@eparinay.com";
        $gbl_request_email = "purabdk@gmail.com";
        $subject = "You received new message from eParinay.com.";
        $body = "This message sended from www.eParinay.com:<BR>";
        $body .= "<BR>Check following link for visit message sender Full Information";
        $body .= "<BR>Sender Profile ID:<a href=profile.php?cid".$_SESSION['ep_customer_id'].">".$_SESSION['ep_customer_id']."</a>";
        $body .= "<BR>Message:".$scrap;
        $body .= "<BR>";
        $header = "From: ".$_SESSION['ep_email']."\r\n";
        $header .= "MIME-Version: 1.0\r\n";
        $header .= "Content-type: text/html; charset=iso-8859-1\r\n";
        if($gblAdminEmail) {
            //mail_new(<to>,<subject>,<body_mail>,<header>,<from>,<CC>);
            mail_new($email,$subject,$body,$header,$email,$sender,$gbl_request_email);

            $mesg = "Thank You !! for submitting your request. Your new password has been e-mailed to you.";
			} else {
				$mesg ="Error Occured! Please try again.";
			}
    }

    
}





}
?>